package StudyCode.summary.textfile;

import java.io.*;
import java.nio.charset.Charset;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class CreatesReaderForReadingSpecifiedFile {
	public static void main(String[] argv) throws Exception {
		File file = new File("E:/Copy/test1.txt");
		System.out.println(openFileReader(file));
	}

	private static final Charset CHARSET = Charset.forName("UTF-8");

	static Reader openFileReader(File file) throws IOException {
		InputStream in = new FileInputStream(file);
		try {
			Reader reader = new InputStreamReader(in, CHARSET);
			in = null;
			return reader;
		} finally {
			if (in != null) {
				in.close();
			}
		}
	}
}
